<?php
if (!$model->parentId) {
	$this->breadcrumbs = array(
		'凭证科目' => array(
			'index'
		),
		'管理',
	);
} else {
	$breadcrumbs = array(
		'管理子科目'
	);
	$parent = $model;
	while ($parent = $parent->parent) {
		$breadcrumbs[$parent->name] = array(
			'admin',
			'parentId' => $parent->id
		);
	}
	$breadcrumbs['管理'] = array(
		'admin',
	);
	$breadcrumbs['凭证科目'] = array(
		'index'
	);
	$this->breadcrumbs = array_reverse($breadcrumbs, true);
}
$this->userActions = array(
	//	array('label'=>'', 'url'=>array('index')),
	array(
		'label' => '新建子科目',
		'url' => array(
			'create',
			'parentId' => $model->parentId
		)
	),
);

?>

<h1>管理凭证科目</h1>
<?php $this
	->widget('zii.widgets.grid.CGridView',
		array(
			'id' => 'account-token-category-grid',
			'dataProvider' => $model->search(),
			'filter' => $model,
			'columns' => CMap::mergeArray(
				array(
					//'id',
					//'parentId',
					'name',
					array(
						'type' => 'raw',
						'header' => '子科目',
						'value' => 'CHtml::link($data->childrenCount,array("admin","parentId"=>$data->id))',
						'filter' => false
					),
					'createTime',
					//'createUserId',
					//'updateTime',
					/*
					'updateUserId',
					 */
					array(
						'class' => 'CButtonColumn',
					),
				),
				AccessControl::isAltMode() ? array()
					: array(
						array(
							'name' => 'initial.debit',
							'type' => 'currency',
							'filter' => false,
							'header' => '初始借方'
						),
						array(
							'name' => 'initial.credit',
							'type' => 'currency',
							'filter' => false,
							'header' => '初始贷方'
						),
						array(
							'header' => AccountTokenProject::getGlobalProjectName(),
							'type' => 'raw',
							'value' => 'CHtml::link("编辑初始",array("accountTokenInitial/update","categoryId"=>$data->id))'
						),
					)),
		));
?>
